import fetch from '@/utils/fetch';

export function getList(query) {
    query._ts = (new Date()).getTime();
    return fetch({
        url: '/admin/list',
        method: 'get',
        params: query
    });
}

export function getDetail(adminId) {
    var _ts = (new Date()).getTime();
    return fetch({
        url: '/admin/detail',
        method: 'get',
        params: {
            adminId,
            _ts
        }
    });
}

export function add(admin) {
    return fetch({
        url: '/admin/add',
        method: 'post',
        data: admin
    });
}

export function update(admin) {
    return fetch({
        url: '/admin/update',
        method: 'post',
        data: admin
    });
}

export function toggleStatus(adminId, status) {
    return fetch({
        url: '/admin/status/toggle',
        method: 'post',
        data: {
            adminId,
            status
        }
    });
}